<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.util.MessageUtil"%>
<%@page import="com.shsh.safemanage.model.PostCheck"%>
<%@page import="com.shsh.safemanage.model.Equipment"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="java.util.Set"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.UserDao"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.model.User"%>

<div class="hider" id="hider">
	<span>&nbsp;</span>
</div>
<div class="position">
	<img src="images/position2.jpg" style="padding: 7px 9px; float: left;" />当前位置：上海高桥分公司问题管理平台 &gt;&gt; 注册
</div>
<%
User registerUser = (User) session.getAttribute(Constants.SESSION_USER);
UserDao userDao = DaoCreator.createUserDao();
%>
<div class="tt">人员信息修改</div>
<div class="content" id="registerDiv">
	<table align="center" border="1" width="700" cellpadding="0"
		cellspacing="0">
		<tr>
			<td class="td1" height="35">
				<span style="margin-left: 30px" class="span1">姓 名：</span>
				<input type="text" name="name" id="name" size="15" value="<%=(registerUser == null)? "":registerUser.getName() %>" />
				<span style="margin-left: 20px" class="span1">工 号：</span>
				<input type="text" name="jobNum" id="jobNum" size="20" value="<%=(registerUser == null)? "":registerUser.getJobNum() %>" />
			</td>
		</tr>
		<tr>
			<td class="td1" height="35">
				<span style="margin-left: 30px">一级单位：</span>
				<span id="depart1SelectSpan">
				<%@include file="depart_select/depart1_select_section.jsp" %>
				</span>
				<br />
				<span style="margin-left: 30px">二级单位：</span>
				<span id="depart2SelectSpan">
				<%@include file="depart_select/depart2_select_section.jsp" %>
				</span>
				<br />
				<span style="margin-left: 30px">职位：</span>
				<span id="depart3SelectSpan">
				<%@include file="depart_select/depart3_select_section.jsp" %>
				</span>
			</td>
		</tr>
		<tr>
			<td class="td1" align="center">
				<input type="button" value="下一步" onclick="register1()" />
			</td>
		</tr>
	</table>
</div>

<script type="text/javascript">
function selectDepart1() {
	var depart1ID = getElementValueByID('depart1');
	loadPageSection('depart_select/depart2_select_section.jsp', 'depart2SelectSpan', {depart1ID:depart1ID}, false, function(){ selectDepart2();});
}

function selectDepart2() {
	var depart1ID = getElementValueByID('depart1');
	var depart2ID = getElementValueByID('depart2');
	loadPageSection('depart_select/depart3_select_section.jsp', 'depart3SelectSpan', {depart1ID:depart1ID, depart2ID:depart2ID}, false);
}

function register1() {
	openWaitingDialog('waitingDialog');
	$.ajax({
		type:'post',
		url:'register1_1_process.jsp',
		data:{
			jobNum: getElementValueByID('jobNum'),
			name: getElementValueByID('name'),
			depart1ID: getElementValueByID('depart1'),
			depart2ID: getElementValueByID('depart2'),
			depart3ID: getElementValueByID('depart3')
		},
		success:function(data,state,xmlhttp){
			var obj = null;
			try {
				obj = eval('(' + data + ')');
			} catch (e) {
			}
			if (typeof(obj.isSuccess) != 'undefined') {
				closeWaitingDialog('waitingDialog');
				if (obj.isSuccess == 'true') {
					if(obj.next == '3' || obj.next == '2') {
						loadPageSection('<%=request.getContextPath()%>/register2_1.jsp', 'registerDiv');
					} else {
						$.dialog('修改信息成功，请重新登录！', function() { 
							loadPageSection('<%=request.getContextPath()%>/login.jsp', 'mainContentDiv', {}, true); 
							loadPageSection('<%=request.getContextPath()%>/menu.jsp', 'mainMenuDiv'); });
					}
				} else {
					$.dialog.alert(obj.error);
				}
			}
		}
	});
}
</script>